﻿using System;
using System.Data;
using System.Collections.Generic;
using Chenxin.Lib.Business.Entity;
namespace Chenxin.Lib.Business.BLL
{
    /// <summary>
    /// 业务逻辑类AutoCode_IntentionControllerInfo 的摘要说明。
    /// </summary>
    public class AutoCode_IntentionControllerInfo
    {
        public AutoCode_IntentionControllerInfo()
        { }
        #region  成员方法
        /// <summary>
        /// 是否存在该记录
        /// </summary>
        public bool Exists(Guid RecordId)
        {
            return Chenxin.Lib.Business.DAL.AutoCode_IntentionControllerInfo.Exists(RecordId);
        }

        /// <summary>
        /// 增加一条数据
        /// </summary>
        public void Add(Chenxin.Lib.Business.Entity.AutoCode_IntentionControllerInfo model)
        {
            Chenxin.Lib.Business.DAL.AutoCode_IntentionControllerInfo.Add(model);
        }

        /// <summary>
        /// 更新一条数据
        /// </summary>
        public void Update(Chenxin.Lib.Business.Entity.AutoCode_IntentionControllerInfo model)
        {
            Chenxin.Lib.Business.DAL.AutoCode_IntentionControllerInfo.Update(model);
        }

        /// <summary>
        /// 删除一条数据
        /// </summary>
        public void Delete(Guid RecordId)
        {

            Chenxin.Lib.Business.DAL.AutoCode_IntentionControllerInfo.Delete(RecordId);
        }

        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Chenxin.Lib.Business.Entity.AutoCode_IntentionControllerInfo GetModel(Guid RecordId)
        {

            return Chenxin.Lib.Business.DAL.AutoCode_IntentionControllerInfo.GetModel(RecordId);
        }

        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public string GetCode(string strWhere)
        {
            return Chenxin.Lib.Business.DAL.AutoCode_IntentionControllerInfo.GetCode(strWhere);
        }

        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Chenxin.Lib.Business.Entity.AutoCode_IntentionControllerInfo GetCurrCode(string strWhere)
        {
            return Chenxin.Lib.Business.DAL.AutoCode_IntentionControllerInfo.GetCurrCode(strWhere);
        }

        /// <summary>
        /// 获得数据列表
        /// </summary>
        public DataSet GetList(string strWhere)
        {
            return Chenxin.Lib.Business.DAL.AutoCode_IntentionControllerInfo.GetList(strWhere);
        }

        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List<Chenxin.Lib.Business.Entity.AutoCode_IntentionControllerInfo> GetModelList(string strWhere)
        {
            DataSet ds = Chenxin.Lib.Business.DAL.AutoCode_IntentionControllerInfo.GetList(strWhere);
            return DataTableToList(ds.Tables[0]);
        }

        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List<Chenxin.Lib.Business.Entity.AutoCode_IntentionControllerInfo> DataTableToList(DataTable dt)
        {
            List<Chenxin.Lib.Business.Entity.AutoCode_IntentionControllerInfo> modelList = new List<Chenxin.Lib.Business.Entity.AutoCode_IntentionControllerInfo>();
            int rowsCount = dt.Rows.Count;
            if (rowsCount > 0)
            {
                Chenxin.Lib.Business.Entity.AutoCode_IntentionControllerInfo model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new Chenxin.Lib.Business.Entity.AutoCode_IntentionControllerInfo();
                    if (dt.Rows[n]["RecordId"].ToString() != "")
                    {
                        model.RecordId = new Guid(dt.Rows[n]["RecordId"].ToString());
                    }
                    model.PrefixCode = dt.Rows[n]["PrefixCode"].ToString();
                    if (dt.Rows[n]["BusinessType"].ToString() != "")
                    {
                        model.BusinessType = dt.Rows[n]["BusinessType"].ToString();
                    }
                    if (dt.Rows[n]["IntentionType"].ToString() != "")
                    {
                        model.IntentionType = dt.Rows[n]["IntentionType"].ToString();
                    }
                    if (dt.Rows[n]["IntentionYear"].ToString() != "")
                    {
                        model.IntentionYear = dt.Rows[n]["IntentionYear"].ToString();
                    }
                    if (dt.Rows[n]["MaxCode"].ToString() != "")
                    {
                        model.MaxCode = int.Parse(dt.Rows[n]["MaxCode"].ToString());
                    }
                    modelList.Add(model);
                }
            }
            return modelList;
        }

        /// <summary>
        /// 获得数据列表
        /// </summary>
        public DataSet GetAllList()
        {
            return GetList("");
        }

        /// <summary>
        /// 获得数据列表
        /// </summary>
        //public DataSet GetList(int PageSize,int PageIndex,string strWhere)
        //{
        //return dal.GetList(PageSize,PageIndex,strWhere);
        //}

        #endregion  成员方法
    }
}

